<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../asset/js/jquery-2.2.4.min.js"></script>
</head>

<body>
  <div>
    <input id="input" type="text">
    <button id="btn">提交</button>
    <ul id="ul">

    </ul>
  </div>
  <script>
    /* 
        M:模型层
        V:视图
        P:控制器
         */
    function Page() {

    }
    $.extend(Page.prototype, {
      init: function () {
        this.bindEvents()
      },
      bindEvents: function () {
        var btn = $('#btn')
        btn.on('click', $.proxy(this.handleBtnClick, this))
      },
      handleBtnClick: function () {
        var inputElem = $('#input')
        var inputValue = $('#input').val()
        var ulElem = $('#ul')
        ulElem.append(`<li>${inputValue}</li>`)
        inputElem.val('')
      }
    })
    var page = new Page();
    page.init()
  </script>
</body>

</html>